package Player;

import java.awt.Color;
import java.util.Vector;
import GameBoard.GameBoard;
import GameElements.Pawn;
import GameElements.Tile;

public abstract class Player 
{
	protected String name = "";
	protected int score = 0;
	protected Vector<Pawn> pawn = new Vector<Pawn>();
	protected Tile tuilePioche = null;
	private Color color;
	protected boolean finishedPlaying = true;
	protected boolean autonome;
	protected int id;
	protected static int nbPlayer=0;

	public abstract void play(GameBoard board);
	
	
	//getters
	public String getNom(){
		return name;
	}
	public int getPoint() {
		return score;
	}
	public Vector<Pawn> getPawn(){
		return pawn;
	}
	public Color getColor(){
		return color;
	}
	public Tile getTuilePioche() {
		return tuilePioche;
	}
	public int getId(){
		return id;
	}
	
	//setters
	public void setName(String name){
		this.name = name;
	}
	public void addPawn(Vector<Pawn> pawn){
		this.pawn.addAll(pawn);
		this.color = pawn.get(0).getColor();
		for(int i=0; i<pawn.size(); i++)
			pawn.get(i).setPossessor(this);
	}
	public void setColor(Color color){
		this.color = color;
	}
	public void setTuilePioche(Tile t){
		tuilePioche = t;
	}


	public void addPoint(int point){
		score = score + point;
	}

	
	public boolean isFinishedPlaying(){
		return finishedPlaying;
	}
	public boolean isAutonome(){
		return autonome;
	}



	public void recupPion(Pawn pion, Tile t) {
		pion.setRole(Pawn.SANS_ROLE);
		pawn.add(pion);
		t.removePawn(pion);
	}		
}
